package com.css.zfzx.sjcj.modules.hddcGeologicalSvyPoint.repository;

import com.css.zfzx.sjcj.modules.hddcGeologicalSvyPoint.repository.entity.HddcGeologicalsvypointEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author lihelei
 * @date 2020-11-27
 */
public interface HddcGeologicalsvypointRepository extends JpaRepository<HddcGeologicalsvypointEntity, String> {
    @Query(nativeQuery = true,value = "select g.* from hddc_geologicalsvypoint g  WHERE g.id=?1 and g.is_valid=1")
    HddcGeologicalsvypointEntity findbyId(String geologicalsvypointid);
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_geologicalsvypoint set qualityinspection_status=:s ,extends1=:str where uuid=:uuid")
    void updateStatus(String s, String str, String uuid);

    @Query(nativeQuery = true,value = "select * from hddc_geologicalsvypoint where is_valid=1 and (qualityinspection_status!=3 or qualityinspection_status is null) ")
    List<HddcGeologicalsvypointEntity> findByAll();
    HddcGeologicalsvypointEntity findByUuidAndIsValid(String id, String isValid);
}
